﻿using Autofac;
using GC_RF.DataAccess.Abstractions.Interfaces.Factories;
using GC_RF.DataAccess.Abstractions.Interfaces.Helpers;
using GC_RF.DataAccess.Factories;
using GC_RF.DataAccess.Helpers;

namespace GC_RF.DataAccess.Modules.Autofac
{
	public class DataAccessModule : Module
	{
		protected override void Load(ContainerBuilder builder)
		{
			base.Load(builder);

			builder.RegisterType<DbContextFactory>().As<IDbContextFactory>().SingleInstance();

			//Dependencies: IDbContextFactory
			builder.RegisterType<UnitOfWork>().As<IUnitOfWork>().SingleInstance();

			//Dependencies: IUnitOfWork
			builder.RegisterType<RepositoryFactory>().As<IRepositoryFactory>().SingleInstance();
		}
	}
}
